package org.lex.ftp.queue;

import javax.swing.Icon;

import org.lex.ftp.util.Resources;
import org.lex.swing.ColorIcon;


public class TaskIconUtils {
	public static Icon getDownloadTaskIcon(DownloadTask task) {
		switch (task.getStatus()) {
		case NEW:
			return DOWNLOAD_WAITING_ICON;
		case RUNNING:
			return DOWNLOAD_RUNNING_ICON;
		case ERROR:
			return ERROR_ICON;
		default:
			return EMPTY;
		}
	}

	public static Icon getUploadTaskIcon(UploadTask task) {
		switch (task.getStatus()) {
		case NEW:
			return UPLOAD_WAITING_ICON;
		case RUNNING:
			return UPLOAD_RUNNING_ICON;
		case ERROR:
			return ERROR_ICON;
		default:
			return EMPTY;
		}
	}

	private static final Icon ERROR_ICON = Resources.getIcon(Resources.DeleteIcon);
	private static final Icon DOWNLOAD_RUNNING_ICON = Resources.getIcon(Resources.DownloadRedIcon);
	private static final Icon DOWNLOAD_WAITING_ICON = Resources.getIcon(Resources.DownloadGreenIcon);
	private static final Icon UPLOAD_RUNNING_ICON = Resources.getIcon(Resources.UploadRedIcon);
	private static final Icon UPLOAD_WAITING_ICON = Resources.getIcon(Resources.UploadGreenIcon);
	private static final Icon EMPTY = new ColorIcon(0, 0);
}
